import vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../pages/Home.vue'


vue.use(VueRouter)

//定义路由
const routes = [

    { path: '/home', component: Home },
    {
        path: '/login',
        name: 'login',
        component: () => import('../pages/Login.vue')
    }, {
        path: '/register',
        name: 'register',
        component: () => import('../pages/Register.vue')
    },
]

const router = new VueRouter({
    //默认hash模式    //  如果在history模式下刷新页面导致找不到页面，去package.json中配置devServer方法  historyApiFallback: true
    mode: 'history',
    routes
})

export default router